package org.xm.sk.vo.tb;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.xm.sk.vo.Base;
import com.fasterxml.jackson.annotation.JsonIgnore;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;


@Entity
@Getter
@Setter
@Table(name = "dc_message")
@ApiModel(value = "Message", parent = Base.class, description = "消息")
public class Message extends Base {

    /**
     * 
     */
    private static final long serialVersionUID = 5510376636404280103L;

    @ApiModelProperty(value = "消息标题")
    @Column(length = 255)
    private String name;

    @ApiModelProperty(value = "消息内容")
    @Column
    private String comment;

    @ApiModelProperty(value = "消息关联客户")
    @JsonIgnore
    @ManyToOne(cascade = { CascadeType.MERGE }, fetch = FetchType.LAZY)
    @JoinColumn(name = "dc_user_id")
    private User user;

    @ApiModelProperty(value = "消息关联的客户ID")
    @Transient
    private Integer userId;
    
    @ApiModelProperty(value = "消息关联的客户名")
    @Transient
    private String userName;
    
}
